<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>L2LB: Referência ao ficheiro interface.h</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Gerado por Doxygen 1.5.6 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Página&nbsp;principal</span></a></li>
      <li><a href="annotated.html"><span>Estruturas&nbsp;de&nbsp;dados</span></a></li>
      <li class="current"><a href="files.html"><span>Ficheiros</span></a></li>
    </ul>
  </div>
</div>
<div class="contents">
<h1>Referência ao ficheiro interface.h</h1>Arquivo responsável por receber e interpretar comandos de administração do L2LB. <a href="#_details">Mais...</a>
<p>
<code>#include &lt;linux/proc_fs.h&gt;</code><br>
<code>#include &lt;asm/uaccess.h&gt;</code><br>
<code>#include &quot;<a class="el" href="cluster_8h-source.html">cluster.h</a>&quot;</code><br>

<p>
<a href="interface_8h-source.html">Ir para o código fonte deste ficheiro.</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Macros</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="interface_8h.html#cb57117519ba69a9fa2bc2ea4661ccaf">PROCFS_MAX_SIZE</a>&nbsp;&nbsp;&nbsp;1024</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="interface_8h.html#b1dafda7cd89906a3be27b9bcd279a0b">PROCFS_NAME</a>&nbsp;&nbsp;&nbsp;&quot;nlb&quot;</td></tr>

<tr><td colspan="2"><br><h2>Funções</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="interface_8h.html#5ed0ad92bc73cd43e19e29f0ff7aa8b4">cmd_add_node</a> (char *args)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Adiciona um servido ao <a class="el" href="structcluster.html" title="Cluster.">cluster</a>.  <a href="#5ed0ad92bc73cd43e19e29f0ff7aa8b4"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="interface_8h.html#f3fa25a0ac2d61c6d5700b9bf0a0132b">cmd_my_node</a> (char *args)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Indica na lista de servidores, qual deles é servidor atual.  <a href="#f3fa25a0ac2d61c6d5700b9bf0a0132b"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="interface_8h.html#955b05c0f5c5662d771a12b4881c479a">procfile_read</a> (char *buffer, char **buffer_location, off_t offset, int buffer_length, int *eof, void *data)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Funçao chamada quando o arquivo /proc/nlb é lido.  <a href="#955b05c0f5c5662d771a12b4881c479a"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="interface_8h.html#140b602157d344e18a9e8750d96d7d81">procfile_write</a> (struct file *file, const char *buffer, unsigned long count, void *data)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Função chamado quando se escreve no arquivo /proc/nlb.  <a href="#140b602157d344e18a9e8750d96d7d81"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="interface_8h.html#65a3f35a0907ebf967e1f54265516827">init_proc_interface</a> (void)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Inicializa a interface do <a class="el" href="structcluster.html" title="Cluster.">cluster</a> criando o arquivo /proc/nlb.  <a href="#65a3f35a0907ebf967e1f54265516827"></a><br></td></tr>
<tr><td colspan="2"><br><h2>Variáveis</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">static struct proc_dir_entry *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="interface_8h.html#86ed009339cd472e0414306129f6650d">my_proc_file</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Esta estrutura mantém informações sobre o arquivo /proc/nlb.  <a href="#86ed009339cd472e0414306129f6650d"></a><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Descrição detalhada</h2>
Arquivo responsável por receber e interpretar comandos de administração do L2LB. 
<p>
Estes comandos são enviados através de /proc/nlb 
<p>Definido no ficheiro <a class="el" href="interface_8h-source.html">interface.h</a>.</p>
<hr><h2>Documentação das macros</h2>
<a class="anchor" name="cb57117519ba69a9fa2bc2ea4661ccaf"></a><!-- doxytag: member="interface.h::PROCFS_MAX_SIZE" ref="cb57117519ba69a9fa2bc2ea4661ccaf" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define PROCFS_MAX_SIZE&nbsp;&nbsp;&nbsp;1024          </td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>

<p>Definido na linha <a class="el" href="interface_8h-source.html#l00015">15</a> do ficheiro <a class="el" href="interface_8h-source.html">interface.h</a>.</p>

<p>Referenciado por <a class="el" href="interface_8h-source.html#l00129">procfile_write()</a>.</p>

</div>
</div><p>
<a class="anchor" name="b1dafda7cd89906a3be27b9bcd279a0b"></a><!-- doxytag: member="interface.h::PROCFS_NAME" ref="b1dafda7cd89906a3be27b9bcd279a0b" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define PROCFS_NAME&nbsp;&nbsp;&nbsp;&quot;nlb&quot;          </td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>

<p>Definido na linha <a class="el" href="interface_8h-source.html#l00016">16</a> do ficheiro <a class="el" href="interface_8h-source.html">interface.h</a>.</p>

<p>Referenciado por <a class="el" href="interface_8h-source.html#l00162">init_proc_interface()</a>.</p>

</div>
</div><p>
<hr><h2>Documentação das funções</h2>
<a class="anchor" name="5ed0ad92bc73cd43e19e29f0ff7aa8b4"></a><!-- doxytag: member="interface.h::cmd_add_node" ref="5ed0ad92bc73cd43e19e29f0ff7aa8b4" args="(char *args)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void cmd_add_node           </td>
          <td>(</td>
          <td class="paramtype">char *&nbsp;</td>
          <td class="paramname"> <em>args</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Adiciona um servido ao <a class="el" href="structcluster.html" title="Cluster.">cluster</a>. 
<p>
O argumento para adicionar um servidor deve ter o seguinte formato:<ul>
<li>{ID},{VIP}</li></ul>
<p>
Onde {ID} é o ID do servidor, e {VIP} é o VLAN-IP do servidor<p>
<dl compact><dt><b>Parâmetros:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>args</em>&nbsp;</td><td>Argumentos para o comando de adicionar um servidor </td></tr>
  </table>
</dl>

<p>Definido na linha <a class="el" href="interface_8h-source.html#l00033">33</a> do ficheiro <a class="el" href="interface_8h-source.html">interface.h</a>.</p>

<p>Referências <a class="el" href="cluster_8h-source.html#l00077">add_cluster_node()</a> e <a class="el" href="utils_8h-source.html#l00033">parse_ipv4_addr()</a>.</p>

<p>Referenciado por <a class="el" href="interface_8h-source.html#l00129">procfile_write()</a>.</p>

</div>
</div><p>
<a class="anchor" name="f3fa25a0ac2d61c6d5700b9bf0a0132b"></a><!-- doxytag: member="interface.h::cmd_my_node" ref="f3fa25a0ac2d61c6d5700b9bf0a0132b" args="(char *args)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void cmd_my_node           </td>
          <td>(</td>
          <td class="paramtype">char *&nbsp;</td>
          <td class="paramname"> <em>args</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Indica na lista de servidores, qual deles é servidor atual. 
<p>
O argumento para este comando é o ID do servidor.<p>
<dl compact><dt><b>Parâmetros:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>args</em>&nbsp;</td><td>Argumento </td></tr>
  </table>
</dl>

<p>Definido na linha <a class="el" href="interface_8h-source.html#l00053">53</a> do ficheiro <a class="el" href="interface_8h-source.html">interface.h</a>.</p>

<p>Referências <a class="el" href="cluster_8h-source.html#l00180">get_node_by_id()</a>, <a class="el" href="heartbeat_8h-source.html#l00094">hb_rebuild_msg()</a>, <a class="el" href="cluster_8h.html#1917b2709741dea7ce5cf6ea441686ed">my_cluster</a>, <a class="el" href="cluster_8h-source.html#l00040">cluster::my_node</a> e <a class="el" href="cluster_8h.html#39e3ce09327c335c6a58f152f9d8fbbf">my_node</a>.</p>

<p>Referenciado por <a class="el" href="interface_8h-source.html#l00129">procfile_write()</a>.</p>

</div>
</div><p>
<a class="anchor" name="65a3f35a0907ebf967e1f54265516827"></a><!-- doxytag: member="interface.h::init_proc_interface" ref="65a3f35a0907ebf967e1f54265516827" args="(void)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int init_proc_interface           </td>
          <td>(</td>
          <td class="paramtype">void&nbsp;</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Inicializa a interface do <a class="el" href="structcluster.html" title="Cluster.">cluster</a> criando o arquivo /proc/nlb. 
<p>

<p>Definido na linha <a class="el" href="interface_8h-source.html#l00162">162</a> do ficheiro <a class="el" href="interface_8h-source.html">interface.h</a>.</p>

<p>Referências <a class="el" href="interface_8h-source.html#l00021">my_proc_file</a>, <a class="el" href="interface_8h-source.html#l00080">procfile_read()</a>, <a class="el" href="interface_8h-source.html#l00129">procfile_write()</a> e <a class="el" href="interface_8h-source.html#l00016">PROCFS_NAME</a>.</p>

<p>Referenciado por <a class="el" href="nlb-driver_8c-source.html#l00100">nlb_init_module()</a>.</p>

</div>
</div><p>
<a class="anchor" name="955b05c0f5c5662d771a12b4881c479a"></a><!-- doxytag: member="interface.h::procfile_read" ref="955b05c0f5c5662d771a12b4881c479a" args="(char *buffer, char **buffer_location, off_t offset, int buffer_length, int *eof, void *data)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int procfile_read           </td>
          <td>(</td>
          <td class="paramtype">char *&nbsp;</td>
          <td class="paramname"> <em>buffer</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char **&nbsp;</td>
          <td class="paramname"> <em>buffer_location</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">off_t&nbsp;</td>
          <td class="paramname"> <em>offset</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>buffer_length</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int *&nbsp;</td>
          <td class="paramname"> <em>eof</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void *&nbsp;</td>
          <td class="paramname"> <em>data</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Funçao chamada quando o arquivo /proc/nlb é lido. 
<p>
Ela retorna o estado do <a class="el" href="structcluster.html" title="Cluster.">cluster</a>:<ul>
<li>A lista de servidores operacionais</li><li>Qual é o próximo servidor que irá atender à requisção de um novo cliente</li><li>Qual é o servidor atual </li></ul>

<p>Definido na linha <a class="el" href="interface_8h-source.html#l00080">80</a> do ficheiro <a class="el" href="interface_8h-source.html">interface.h</a>.</p>

<p>Referências <a class="el" href="cluster_8h-source.html#l00038">cluster::head</a>, <a class="el" href="cluster_8h-source.html#l00017">cluster_node::id</a>, <a class="el" href="cluster_8h.html#1917b2709741dea7ce5cf6ea441686ed">my_cluster</a>, <a class="el" href="cluster_8h-source.html#l00040">cluster::my_node</a>, <a class="el" href="cluster_8h-source.html#l00014">cluster_node::next</a>, <a class="el" href="cluster_8h-source.html#l00041">cluster::next_serving</a> e <a class="el" href="cluster_8h-source.html#l00018">cluster_node::vlan_ip</a>.</p>

<p>Referenciado por <a class="el" href="interface_8h-source.html#l00162">init_proc_interface()</a>.</p>

</div>
</div><p>
<a class="anchor" name="140b602157d344e18a9e8750d96d7d81"></a><!-- doxytag: member="interface.h::procfile_write" ref="140b602157d344e18a9e8750d96d7d81" args="(struct file *file, const char *buffer, unsigned long count, void *data)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int procfile_write           </td>
          <td>(</td>
          <td class="paramtype">struct file *&nbsp;</td>
          <td class="paramname"> <em>file</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&nbsp;</td>
          <td class="paramname"> <em>buffer</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned long&nbsp;</td>
          <td class="paramname"> <em>count</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void *&nbsp;</td>
          <td class="paramname"> <em>data</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Função chamado quando se escreve no arquivo /proc/nlb. 
<p>
O conteúdo escrito é um dos comando administrativos abaixo:<ul>
<li>Adiciona servidores ao <a class="el" href="structcluster.html" title="Cluster.">cluster</a></li><li>Define o meu servidor</li><li>Define o protocolo que sera balanceado </li></ul>

<p>Definido na linha <a class="el" href="interface_8h-source.html#l00129">129</a> do ficheiro <a class="el" href="interface_8h-source.html">interface.h</a>.</p>

<p>Referências <a class="el" href="interface_8h-source.html#l00033">cmd_add_node()</a>, <a class="el" href="interface_8h-source.html#l00053">cmd_my_node()</a> e <a class="el" href="interface_8h-source.html#l00015">PROCFS_MAX_SIZE</a>.</p>

<p>Referenciado por <a class="el" href="interface_8h-source.html#l00162">init_proc_interface()</a>.</p>

</div>
</div><p>
<hr><h2>Documentação das variáveis</h2>
<a class="anchor" name="86ed009339cd472e0414306129f6650d"></a><!-- doxytag: member="interface.h::my_proc_file" ref="86ed009339cd472e0414306129f6650d" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">struct proc_dir_entry* <a class="el" href="interface_8h.html#86ed009339cd472e0414306129f6650d">my_proc_file</a><code> [static]</code>          </td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Esta estrutura mantém informações sobre o arquivo /proc/nlb. 
<p>

<p>Definido na linha <a class="el" href="interface_8h-source.html#l00021">21</a> do ficheiro <a class="el" href="interface_8h-source.html">interface.h</a>.</p>

<p>Referenciado por <a class="el" href="interface_8h-source.html#l00162">init_proc_interface()</a>.</p>

</div>
</div><p>
</div>
<hr size="1"><address style="text-align: right;"><small>Gerado em Wed Sep 10 23:05:55 2008 para L2LB por&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.6 </small></address>
</body>
</html>
